import { ECUPIChannel, ECVISChannel, ECMCCChannel, ECJCBChannel } from '@shared/interfaces/acquirer'
import { parseCurValue, numScale, channelSorter } from 'app/utils/helpers'

export const getECUPIChannelColumns = (channel: ECUPIChannel) => {
  return [
    [
      {
        span: 8,
        label: 'chanCode',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'Acquiring IIN',
        value: channel.acquiringIIN,
      },
      {
        span: 8,
        label: 'Channel Merchant Name',
        value: channel.chanMerName,
      },
    ],
    [
      {
        span: 8,
        label: 'Transaction Currency',
        value: parseCurValue(channel.currencies),
      },
      {
        span: 8,
        label: 'Channel Encryption Public Key ID',
        value: channel.chanEncryptPubKeyId,
      },
      {
        span: 8,
        label: 'Channel Encryption Public Key',
        value: channel.chanEncryptPubKey,
      },
    ],
    [
      {
        span: 8,
        label: 'Channel Sign Public Key ID',
        value: channel.chanSignPubKeyId,
      },
      {
        span: 8,
        label: 'Channel Sign Public Key',
        value: channel.chanSignPubKey,
      },
      {
        span: 8,
        label: 'CIL Encryption Private Key ID',
        value: channel.cilEncryPriKeyId,
      },
    ],
    [
      {
        span: 8,
        label: 'CIL Encryption Private Key',
        value: channel.cilEncryPriKey,
      },
      {
        span: 8,
        label: 'CIL Sign Private Key ID',
        value: channel.cilSignPriKeyId,
      },
      {
        span: 8,
        label: 'CIL Sign Private Key',
        value: channel.cilSignPriKey,
      },
    ],
    [
      {
        span: 20,
        label: 'Transaction Fee',
        value: channel.fee ? numScale(channel.fee, 2) + ' % ' : undefined,
      },

      {
        span: 4,
        label: '操作',
        labelI18n: 'GENERAL.INFO.OPERATION',
        operate: true,
        acl: ['api.delete.toz.institution.one.channel'],
      },
    ],
  ]
}

export const getECVISChannelColumns = (channel: ECVISChannel) => {
  return [
    [
      {
        span: 8,
        label: 'Payment Brand',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'channel',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'Merchant ID',
        value: channel.chanMerId,
      },
    ],
    [
      {
        span: 6,
        label: 'Transaction Currency',
        value: parseCurValue(channel.currencies),
      },
      {
        span: 6,
        label: 'Transaction Fee',
        value: channel.fee ? numScale(channel.fee, 2) + ' % ' : undefined,
      },
      {
        span: 8,
        label: 'Channel Merchant Name',
        value: channel.chanMerName,
      },
      {
        span: 4,
        label: '操作',
        labelI18n: 'GENERAL.INFO.OPERATION',
        operate: true,
        acl: ['api.delete.toz.institution.one.channel'],
      },
    ],
  ]
}

export const getECMCCChannelColumns = (channel: ECVISChannel) => {
  return [
    [
      {
        span: 8,
        label: 'Payment Brand',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'channel',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'Merchant ID',
        value: channel.chanMerId,
      },
    ],
    [
      {
        span: 6,
        label: 'Transaction Currency',
        value: parseCurValue(channel.currencies),
      },
      {
        span: 6,
        label: 'Transaction Fee',
        value: channel.fee ? numScale(channel.fee, 2) + ' % ' : undefined,
      },
      {
        span: 8,
        label: 'Channel Merchant Name',
        value: channel.chanMerName,
      },
      {
        span: 4,
        label: '操作',
        labelI18n: 'GENERAL.INFO.OPERATION',
        operate: true,
        acl: ['api.delete.toz.institution.one.channel'],
      },
    ],
  ]
}

export const getECJCBChannelColumns = (channel: ECVISChannel) => {
  return [
    [
      {
        span: 8,
        label: 'Payment Brand',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'channel',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'Merchant ID',
        value: channel.chanMerId,
      },
    ],
    [
      {
        span: 6,
        label: 'Transaction Currency',
        value: parseCurValue(channel.currencies),
      },
      {
        span: 6,
        label: 'Transaction Fee',
        value: channel.fee ? numScale(channel.fee, 2) + ' % ' : undefined,
      },
      {
        span: 8,
        label: 'Channel Merchant Name',
        value: channel.chanMerName,
      },
      {
        span: 4,
        label: '操作',
        labelI18n: 'GENERAL.INFO.OPERATION',
        operate: true,
        acl: ['api.delete.toz.institution.one.channel'],
      },
    ],
  ]
}

export const getECKBANKChannelColumns = (channel: ECVISChannel) => {
  return [
    [
      {
        span: 8,
        label: 'channel',
        value: channel.chanCode,
      },
      {
        span: 8,
        label: 'Merchant ID',
        value: channel.chanMerId,
      },
      {
        span: 8,
        label: 'Transaction Currency',
        value: parseCurValue(channel.currencies),
      },
    ],
    [
      {
        span: 8,
        label: 'Transaction Fee',
        value: channel.fee ? numScale(channel.fee, 2) + ' % ' : undefined,
      },
      {
        span: 8,
        label: 'Channel Merchant Name',
        value: channel.chanMerName,
      },
      {
        span: 6,
        label: '操作',
        labelI18n: 'GENERAL.INFO.OPERATION',
        operate: true,
        acl: ['api.delete.toz.institution.one.channel'],
      },
    ],
  ]
}
